

import random
import os

class ResultSet(object):
    """Class that contains the result set of a select statement executed"""
    def __init__(self, rw_serie):
        self._rw_serie = rw_serie
        self._c_iter = -1
    
    def next(self):
        return self._next().next()
    
    def _next(self):
        for n in sorted(self._rw_serie):
            yield n
    
    def __iter__(self):
        """returns the iterator itself"""
        return self
    
    def __len__(self):
        """returns the size of underlying data"""
        return len(self._rw_serie)
    
    def __str__(self):
        """returns the string representation of time series data"""
        return os.linesep.join([' '.join(row) for row in self._rw_serie])


l = range(10)
random.shuffle(l)
rs = ResultSet(l)

for i in rs:
    print i